package cn.xianshu.org.service.impl;

import cn.xianshu.basic.query.BasicQuery;
import cn.xianshu.basic.service.impl.BasicServiceImpl;
import cn.xianshu.basic.util.PageList;
import cn.xianshu.org.domain.SystemsType;
import cn.xianshu.org.mapper.SystemsTypeMapper;
import cn.xianshu.org.query.SystemsTypeQuery;
import cn.xianshu.org.service.ISystemsTypeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service
//@Transactional(readOnly = true, propagation = Propagation.SUPPORTS)
public class SystemsTypeServiceImpl extends BasicServiceImpl<SystemsType> implements ISystemsTypeService {
    @Autowired
    private SystemsTypeMapper systemsTypeMapper;

    @Override
    @Transactional
    public void update(SystemsType systemsType) {
        systemsTypeMapper.update(systemsType);
    }

    @Override
    public PageList<SystemsType> queryList(BasicQuery query) {
        // 总条数
        Integer totals = systemsTypeMapper.count(query);
        // 当前页数据
        List<SystemsType> rows = systemsTypeMapper.queryData(query);
        return new PageList<>(totals, rows);

    }
   @Override
   public PageList<SystemsType> pageQuery(SystemsTypeQuery query) {
       // 总条数
       Integer total = systemsTypeMapper.count(query);
       // 每页显示数据
       List<SystemsType> rows = systemsTypeMapper.queryData(query);
       return new PageList<>(total, rows);
   }
    @Override
    public List<SystemsType> queryTree() {
        return systemsTypeMapper.queryTree();
    }

}
